BDMS 114 & Others: add value_reason to observation | update FieldEventContactAssociation | remove geothermal clutter#171
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
|
jirhiker
approved these changes
Oct 3, 2025
ksmuczynski
reviewed
Oct 3, 2025
ksmuczynski
reviewed
Oct 3, 2025
ksmuczynski
reviewed
Oct 3, 2025
ksmuczynski
approved these changes
Oct 3, 2025
TylerAdamMartinez
approved these changes
Oct 3, 2025
TylerAdamMartinez
left a comment
Contributor
There was a problem hiding this comment.
Great refactor here! 😄
Contributor
There was a problem hiding this comment.
As this file grows, it would make sense to refactor the api/observation.py section into smaller, more focused modules (e.g., api/observation/get.py, api/observation/post.py, etc.) to improve maintainability and clarity.
Contributor
Author
There was a problem hiding this comment.
Would you suggest that for all routers? Every one has GET, POST, PATCH, and DELETE methods defined in them.
jirhiker
approved these changes
Oct 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
This PR addresses the following problem / context:
FieldEventContactAssociationis an unclear nameHow
Implementation summary - the following was changed / added / removed:
level_statustovalue_reasonand made it a non-nullable field for all observations. Thevalue_reasonfield allows users to provide context for a single observation value. This is particularly important forNULLwater levels so we can deduce which areNULLbecause the well is dry (as opposed to other reasons like an obstruction)FieldEventContactAssociationwas renamedFieldEventParticipantfor clarityobservationtable was removed to declutter the code baseNotes
Any special considerations, workarounds, or follow-up work to note?
NULL:FieldEventrecord is made but noObservationorSamplerecords are made. It is then noted in theFieldEventrecord why this happened. A restricted vocabulary could be useful, but there are so many things that can go wrong we thought to just have it noted in thenotesfield. This could be anything from a flat tire to a locked gate to muddy roads to a destroyed well.StatusHistory, too.WaterLevelsrecord that indicates a destroyed well will create aFieldEventrecord but nosampleorobservationobservationrecord is made,valueis set toNULL, and controlled vocabulary is used invalue_reasonto indicate why it isNULL. As written above, this is particularly important for water levels so we can deduce if a well is dry or not.